package com.sam.spring.chapter3;

import junit.framework.Assert;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

import com.sam.spring.chapter3.bean.ResourceBean2;

public class ResourceInjectTest {
	@Test
	public void test() {
		ApplicationContext ctx = new ClassPathXmlApplicationContext(
				"chapter3/resourceInject.xml");
		ResourceBean2 resourceBean1 = ctx.getBean("resourceBean1",
				ResourceBean2.class);
		ResourceBean2 resourceBean2 = ctx.getBean("resourceBean2",
				ResourceBean2.class);
		Assert.assertTrue(resourceBean1.getResource() instanceof ClassPathResource);
		Assert.assertTrue(resourceBean2.getResource() instanceof ClassPathResource);
	}
}
